#ifndef __GLCAVAS_H__
#define __GLCAVAS_H__


#include "wx/glcanvas.h"

class GLCanvas : public wxGLCanvas
{
public:
	GLCanvas(wxWindow *parent,
		wxWindowID id = wxID_ANY,
		int *gl_attrib = NULL);

	virtual ~GLCanvas();

	virtual void OnPaint(wxPaintEvent& event);
	virtual void OnSize(wxSizeEvent& event);
	virtual void OnChar(wxKeyEvent& event);
	virtual void OnMouseEvent(wxMouseEvent& event);

	bool SetupPixelFormat();
	void InitGL();
	wxGLContext* GetGLRC();
	void SetCurrent();
	void AdjustOGLViewport(wxSize viewport);
	void SetDesignResolutionSize(wxSize size);

	static GLCanvas* get();

private:
	static GLCanvas* glCanvas;

	wxGLContext* m_glRC;
	wxSize m_sDesignResolutionSize;

	GLfloat m_xrot;
	GLfloat m_yrot;

	static bool m_bCocos2dxInitFlag;

	//wxDECLARE_NO_COPY_CLASS(GLCanvas);
	DECLARE_EVENT_TABLE()
};




#endif